<?php
/** 
* 支付汇率
* 
* 支付汇率相关操作
* @author         enj<yinjian@uuch.net> 
* @since          1.0 
*/
class Application_Model_SystemConfig extends Application_Model_DomainObject
{

    protected $_id; 
    protected $_name; 
    protected $_value; 

    /**
     * 更新
    */
    public static function dataUp($data = array())
    {
        if(empty($data)){
            return null;
        }
        $rate = Application_Model_SystemConfig::load($data['id']);
        $rate->value    = $data['value'];
        $rate->save();

        $change = array(
                        'id'        =>  $rate->id,
                        'name'      =>  $rate->name,
                        'value'     =>  $rate->value,
                    );
        //日志
        Application_Model_Operate::addOperate(0, null, 0, "后台支付汇率(更新):" . json_encode($change), 0);
        return $rate->id;
    }

    /**
     * 获取配置信息
     * @param  string $name
     * @return obj
    */
    public static function getRateByName($name)
    {
        if(!empty($name)){
            $rate = self::getDao()->queryOne(array("name" => $name));
        }else{
            $rate = null;
        }
        return $rate;
    }

}